(function ($) {
    $.fn.scrollTable2 = function (options) {
        var defaults = {
            interval: options.interval || 3000,
            scrollByRow: options.scrollByRow||false,
            step: options.step||5,
        };
        var realTable = $(this);
        // var cloneTable = $(this).find('.tb2');
        var step = defaults.scrollByRow?realTable.find('.tr').outerHeight(true):defaults.step;
        var scrollInterval=null,scrollIndex = 0;
        scrollTimer = setInterval(() => {
            var  $self =$(this);
            scrollIndex++
             if(scrollIndex>10){
                scrollIndex=0
             }
       $self.find('.tr:first').addClass('active').siblings().removeClass('active')
        const outerHeight = $self.find('.tr:first').height();
        // 改变table的margin-top，定时将第一行tr挪至（列表）最后
         $self.animate({'marginTop': -outerHeight + 'px'},500, () => {
          $self.css({margin: 0}).find('.tr:first').appendTo($self); 
        });
         },defaults.interval);
        return scrollInterval;
    };
  
 
})(jQuery);